﻿
//Versione 1.0 dev by : Diego Stefanon  AngularJS v1.2.16 //
"use strict";

//alert("Core 1");


//dev by : Diego Stefanon  AngularJS v1.2.16 //
var myAppRoute = angular.module('myAppRoute', ['ngRoute']);


myAppRoute.service('myCommonService', function ($http) {

    this.get = function () {
        return $http({
            method: 'POST',
            url: "http://localhost:4453/Mappe.svc/GetStazioniSensori",
            responseType: 'json',
            data: JSON.stringify({ pIdSens: 101 })
        });
    } //fm

    this.testService = function ()
    { alert('In test service'); }

});//end service


myAppRoute.controller('myCtrl', ['$scope', '$http', '$timeout', 'myCommonService', '$window', '$location',
    '$route', '$routeParams',
    function ($scope, $http, $timeout, IDatiService, $window, $location, $route, $routeParams) {

        $scope.host = window.location.host;
        $scope.hostHttp = "http://" + window.location.host;
        $scope.datiBoxAll = "[]";
        $scope.boxCounter = -1;

    }]);

myAppRoute.controller('AController', ['$scope', '$http', '$timeout', '$route,', '$routeParams',
       function ($scope, $http, $timeout, $route, $routeParams) { //
           //

       }]);

//to the end
myAppRoute.config(['$routeProvider',
  function ($routeProvider) {
      $routeProvider.
        when('/page1', {
            templateUrl: 'html/Page1.html',
            controller: 'myCtrl'
        }).
        when('/page2', {
            templateUrl: 'html/Page2.html',
            controller: 'myCtrl'
        })
      .when('/page3', {
          templateUrl: 'html/Page3.html',
          controller: 'myCtrl'
      })
        .otherwise({
            redirectTo: '/page2'
        });
  }]);

